﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 相对路径，相对于当前访问的文件的位置开始查找 -->
    <link rel="stylesheet" href="/static/admin/css/bootstrap.css">
    <link rel="stylesheet" href="/static/admin/js/jquery-2.1.0.min.js">
    <style>
       .cus-container{
           width: 1368px;
       }
       .success th,table td{text-align:center;}
    </style>
</head>
<body>
    <div class="container cus-container">
    	
        <h3 class="text-center" style="font-weight:bold">banner列表</h3>
        <div>
           
            <!-- 添加、删除的按钮 -->
            <div style="float: right;margin: 10px 0px;">
                <a class="btn btn-primary" href="/admin/banner/add">添加banner</a>
                <a class="btn btn-primary" href="" id="delSelected">删除选中</a>
            </div>
        </div>

      
       <table class="table table-bordered clearfix">
        <tr class="success">
            <th><input type="checkbox" id="firstCb"></th>
            <th>banner编号</th>
            <th>banner图片</th>
            <th>状态</th>
            <th>关联的路线</th>
            <th>操作</th>
        </tr>        
        <tr th:each="banner:${pb.list}">
            <td style="vertical-align:middle"><input type="checkbox" name="gid" value=""></td>
            <td style="vertical-align:middle" th:text="${banner.bannerId}">

            </td>
            <td style="width:500px;vertical-align:middle">
                <img th:src="'/upload/'+${banner.imgSrc}" style="width:100%" height="180px">
            </td>
            <td style="vertical-align:middle" >
               <span th:if="${banner.isShow}==1">显示</span>
                <span th:if="${banner.isShow}==0">隐藏</span>
            </td>
            <td style="vertical-align:middle" th:each="route:${routeList}"  th:if="${banner.routeId == route.routeId}">
               <span th:text="${route.routeName}"></span>
            </td>
            <td style="vertical-align:middle">
                <a class="btn btn-default btn-sm" th:href="'/admin/banner/edit?bid='+${banner.bannerId }">修改</a>&nbsp;
                <a class="btn btn-default btn-sm deleteBtn" th:href="'/admin/banner/delete?bid='+${banner.bannerId }">删除</a>
            </td>
            <form id="deleteEmpForm" method="post">
                <input type="hidden" name="_method" value="delete"/>
            </form>
        </tr>



      <script>
           $(".deleteBtn").click(function(){
               //删除当前员工的
               $("#deleteEmpForm").attr("action",$(this).attr("href")).submit();
               return false;
           });
       </script>
      </table>


        <!-- 分页导航 -->
        <div>
            <!-- 分页导航 -->
            <nav style="float: left;">
                <ul class="pagination">
                    <li th:if="${pb.dangqianye > 0}">
                        <a th:href="'/admin/banner/list?page='+${pb.dangqianye - 1}" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>

                    <li th:if="${pb.dangqianye <= 0}">
                        <a href="javascript:void(0)">
                            <span>&laquo;</span>
                        </a>
                    </li>


                    <li th:each="i:${#numbers.sequence(0,pb.pagenum-1)}">
                        <a  th:href="'/admin/banner/list?page='+${i}" th:text="${i+1}"></a>
                    </li>

                    <li th:if="${pb.dangqianye < pb.pagenum}">
                        <a th:href="'/admin/banner/list?page='+${pb.dangqianye + 1}" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>

                    <li th:if="${pb.dangqianye >= pb.pagenum}">
                        <a href="javascript:void(0)">
                            <span>&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
            <div style="float: right;margin-top: 25px;">
                <span th:text="'共'+${pb.count}+'条记录，分'+${pb.pagenum}+'页显示'"></span>
            </div>
        </div>



    </div>
</body>
</html>